home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_52 / scales.ma < prev    next >
Text File  |  1995-01-01  |  7KB  |  318 lines

  1. # scales.ma
  2. #
  3. # a library of scale forms.
  4. #
  5. # Scales are defined by the following:
  6. # 1. a constant for the name which is used as an array index,
  7. # 2. 3 arrays. The first is used for scale size. The second and
  8. # third provide different ways of looking up a note. 
  9. # Half-tone (chromatic) offsets are used in each case.
  10. #
  11. # Each scale is defined twice; i.e., there
  12. # are two forms of offset lookup tables. 
  13. # The first table has the form of offsets in half-steps 
  14. # from the base scale note; e.g.,
  15. # a major scale consists of 0,2,4,5 for the unison, major
  16. # second and major third.
  17. # The second table has the form of offsets from the last
  18. # scale note; e.g., a major scale consists of 0,2,2.., etc.
  19. #
  20. # These two arrays are referred to as
  21. # "baseScale" and "lastScale". With the first form
  22. # the note is calculated from the base note of the scale,
  23. # e.g.,
  24. # note = C + baseScale[IONIAN][FIFTH]
  25. #
  26. # The lastScale array permits easy access of the next
  27. # scale degree from the previous, e.g.,
  28. # nextnote = lastnote + baseScale[IONIAN][curindex]
  29. #
  30. # Functions:
  31. #    riff printScale(scale) - print the string name of the scale
  32. #
  33.  
  34. export
  35.     scaleSizes,
  36.     baseScale,
  37.     printScale
  38. end
  39.  
  40. @include \mh\scales.mh
  41.  
  42. # octave is not included. Intended for use with
  43. # baseScale array.
  44. #
  45. uchar scaleSizes[NOSCALES] = {
  46. # MAJOR
  47. 7,
  48. # IONIAN
  49. 7,
  50. # DORIAN
  51. 7,
  52. # PHRYGIAN
  53. 8,
  54. # LYDIAN
  55. 7,
  56. # MIXOLYDIAN
  57. 7,
  58. # AEOLIAN
  59. 7,
  60. # LOCRIAN
  61. 7,
  62. # PURE_MINOR 
  63. 7,
  64. # HARMONIC_MINOR 
  65. 7,
  66. # MELODIC_MINOR_UP
  67. 7,
  68. # MELODIC_MINOR_DOWN
  69. 7,
  70. # LOCRIAN_ON_SECOND 
  71. 7,
  72. # LYDIAN_DOMINANT 
  73. 7,
  74. # SUPER_LOCRIAN    
  75. 7,
  76. # DIM    
  77. 4,
  78. # DIMWHOLE
  79. 8,
  80. # DIMHALF    
  81. 8,
  82. # WHOLETONE    
  83. 6,
  84. # CHROMATIC
  85. 11,
  86. # BLUESONE
  87. 5,
  88. # BLUESTWO
  89. 6,
  90. # PENTA        
  91. 5,
  92. # PENTAIONIAN
  93. 5,
  94. # PENTADORIAN
  95. 5,
  96. # PENTAPHRYGIAN
  97. 5,
  98. # PENTALYDIAN
  99. 5,
  100. # PENTAAEOLIAN
  101.  
  102. # octave is included here but is not
  103. # in scalesize
  104. #
  105. uchar baseScale[NOSCALES][MAXNOTES] =  {
  106. # MAJOR    
  107. 0,2,4,5,7,9,11,12,{-1},0,0,0,0,0,0,
  108. # IONIAN
  109. 0,2,4,5,7,9,11,12,{-1},0,0,0,0,0,0,
  110. # DORIAN
  111. 0,2,3,5,7,9,10,12,{-1},0,0,0,0,0,0,
  112. # PHRYGIAN
  113. 0,1,3,5,7,8,10,12,{-1},0,0,0,0,0,0,
  114. # LYDIAN
  115. 0,2,4,6,7,9,11,12,{-1},0,0,0,0,0,0,
  116. # MIXOLYDIAN
  117. 0,2,4,5,7,9,10,12,{-1},0,0,0,0,0,0,
  118. # AEOLIAN
  119. 0,2,3,5,7,8,10,12,{-1},0,0,0,0,0,0,
  120. # LOCRIAN
  121. 0,1,3,5,6,8,10,12,{-1},0,0,0,0,0,0,
  122. # PURE_MINOR 
  123. 0,2,3,5,7,8,10,12,{-1},0,0,0,0,0,0,
  124. # HARMONIC_MINOR 
  125. 0,2,3,5,7,8,11,12,{-1},0,0,0,0,0,0,
  126. # MELODIC_MINOR_UP 
  127. 0,2,3,5,7,9,11,12,{-1},0,0,0,0,0,0,
  128. # MELODIC_MINOR_DOWN 
  129. 0,2,3,5,7,8,10,12,{-1},0,0,0,0,0,0,
  130. # LOCRIAN_ON_SECOND 
  131. 0,2,3,5,6,8,10,12,{-1},0,0,0,0,0,0,
  132. # LYDIAN_DOMINANT 
  133. 0,2,4,6,7,9,10,12,{-1},0,0,0,0,0,0,
  134. # SUPER_LOCRIAN
  135. 0,1,3,4,6,8,10,12,{-1},0,0,0,0,0,0,
  136. # DIM    
  137. 0,3,6,9,12,{-1},0,0,0,0,0,0,0,0,0,
  138. # DIMWHOLE
  139. 0,2,3,5,6,8,9,11,12,{-1},0,0,0,0,0,
  140. # DIMHALF        
  141. 0,1,3,4,6,7,9,10,12,{-1},0,0,0,0,0,
  142. # WHOLETONE    
  143. 0,2,4,6,8,10,12,{-1},0,0,0,0,0,0,0,
  144. # CHROMATIC
  145. 0,1,2,3,4,5,6,7,8,9,10,11,12,{-1},0,
  146. # BLUESONE
  147. 0,3,5,7,10,12,{-1},0,0,0,0,0,0,0,0,
  148. # BLUESTWO
  149. 0,3,4,5,7,10,12,{-1},0,0,0,0,0,0,0,
  150. # PENTA        
  151. 0,2,4,7,9,12,{-1},0,0,0,0,0,0,0,0,
  152. # PENTAIONIAN
  153. 0,2,4,7,9,12,{-1},0,0,0,0,0,0,0,0,
  154. # PENTADORIAN
  155. 0,2,5,7,10,12,{-1},0,0,0,0,0,0,0,0,
  156. # PENTAPHRYGIAN    
  157. 0,3,5,8,10,12,{-1},0,0,0,0,0,0,0,0,
  158. # PENTALYDIAN
  159. 0,2,5,7,9,12,{-1},0,0,0,0,0,0,0,0,
  160. # PENTAAEOLIAN
  161. 0,3,5,7,10,12,{-1},0,0,0,0,0,0,0,0 
  162. }
  163.  
  164. #
  165. # lastscale - offset from previous note.
  166. # needs a size array.
  167. #
  168. uchar lastscale[NOSCALES][MAXNOTES] =  {
  169. # MAJOR    
  170. 0,2,2,1,2,2,2,1,{-1},0,0,0,0,0,0,
  171. # IONIAN
  172. 0,2,2,1,2,2,2,1,{-1},0,0,0,0,0,0,
  173. # DORIAN
  174. 0,2,1,2,2,2,1,2,{-1},0,0,0,0,0,0,
  175. # PHRYGIAN
  176. 0,1,2,2,2,1,2,2,{-1},0,0,0,0,0,0,
  177. # LYDIAN
  178. 0,2,2,2,1,2,2,1,{-1},0,0,0,0,0,0,
  179. # MIXOLYDIAN
  180. 0,2,2,1,2,2,1,2,{-1},0,0,0,0,0,0,
  181. # AEOLIAN
  182. 0,2,1,2,2,1,2,2,{-1},0,0,0,0,0,0,
  183. # LOCRIAN
  184. 0,1,2,2,1,2,2,2,{-1},0,0,0,0,0,0,
  185. # PURE_MINOR 
  186. 0,2,1,2,2,1,2,2,{-1},0,0,0,0,0,0,
  187. # HARMONIC_MINOR 
  188. 0,2,1,2,2,1,3,1,{-1},0,0,0,0,0,0,
  189. # MELODIC_MINOR_UP
  190. 0,2,1,2,2,2,2,1,{-1},0,0,0,0,0,0,
  191. # MELODIC_MINOR_DOWN
  192. 0,2,1,2,2,1,2,2,{-1},0,0,0,0,0,0,
  193. # LOCRIAN_ON_SECOND 
  194. 0,1,2,2,1,2,2,2,{-1},0,0,0,0,0,0,
  195. # LYDIAN_DOMINANT 
  196. 0,2,2,2,1,2,1,2,{-1},0,0,0,0,0,0,
  197. # SUPER_LOCRIAN    
  198. 0,1,2,1,2,2,2,2,{-1},0,0,0,0,0,0,
  199. # DIM        
  200. 0,3,3,3,3,{-1},0,0,0,0,0,0,0,0,0,
  201. # DIMWHOLE
  202. 0,2,1,2,1,2,1,2,1,{-1},0,0,0,0,0,
  203. # DIMHALF    
  204. 0,2,1,2,1,2,1,2,1,{-1},0,0,0,0,0,
  205. # WHOLETONE
  206. 0,2,2,2,2,2,2,{-1},0,0,0,0,0,0,0,
  207. # CHROMATIC
  208. 0,1,1,1,1,1,1,1,1,1,1,1,1,{-1},0,
  209. # BLUESONE
  210. 0,3,2,2,3,2,{-1},0,0,0,0,0,0,0,0,
  211. # BLUESTWO
  212. 0,3,1,2,2,3,2,{-1},0,0,0,0,0,0,0,
  213. # PENTA    
  214. 0,2,2,3,2,3,{-1},0,0,0,0,0,0,0,0,
  215. # PENTAIONIAN
  216. 0,2,2,3,2,3,{-1},0,0,0,0,0,0,0,0,
  217. # PENTADORIAN
  218. 0,2,3,2,3,2,{-1},0,0,0,0,0,0,0,0,
  219. # PENTAPHRYGIAN    
  220. 0,3,2,3,2,2,{-1},0,0,0,0,0,0,0,0,
  221. # PENTALYDIAN
  222. 0,2,3,2,2,3,{-1},0,0,0,0,0,0,0,0,
  223. # PENTAAEOLIAN    
  224. 0,3,2,2,3,2,{-1},0,0,0,0,0,0,0,0 
  225. }
  226.  
  227. riff printScale(scale)
  228.     switch (scale)
  229.     case MAJOR:
  230.         void printf("major")
  231.     end
  232.     case IONIAN:
  233.         void printf("ionian")
  234.     end
  235.     case DORIAN:
  236.         void printf("dorian")
  237.     end
  238.     case PHRYGIAN:
  239.         void printf("phrygian")
  240.     end
  241.     case LYDIAN:
  242.         void printf("lydian")
  243.     end
  244.     case MIXOLYDIAN:
  245.         void printf("mixolydian")
  246.     end
  247.     case AEOLIAN:
  248.         void printf("aeolian")
  249.     end
  250.     case LOCRIAN:
  251.         void printf("locrian")
  252.     end
  253.     case PURE_MINOR:
  254.         void printf("pure minor")
  255.     end
  256.     case HARMONIC_MINOR:
  257.         void printf("harmonic minor")
  258.     end
  259.     case MELODIC_MINOR_UP:
  260.         void printf("melodic minor up")
  261.     end
  262.     case MELODIC_MINOR_DOWN:
  263.         void printf("melodic minor down")
  264.     end
  265.     case LOCRIAN_ON_SECOND:
  266.         void printf("locrian on second") 
  267.     end
  268.     case LYDIAN_DOMINANT:
  269.         void printf("lydian dominant")
  270.     end
  271.     case SUPER_LOCRIAN:
  272.         void printf("super locrian")
  273.     end
  274.     case DIM:
  275.         void printf("diminished")
  276.     end
  277.     case DIMWHOLE:
  278.         void printf("diminished whole-half") 
  279.     end
  280.     case DIMHALF:
  281.         void printf("diminished half-whole") 
  282.     end
  283.     case WHOLETONE:
  284.         void printf("whole tone")
  285.     end
  286.     case CHROMATIC:
  287.         void printf("chromatic")
  288.     end
  289.     case BLUESONE:
  290.         void printf("blues scale one")
  291.     end
  292.     case BLUESTWO:
  293.         void printf("blues scale two")
  294.     end
  295.     case PENTA:
  296.         void printf("pentatonic major")
  297.     end
  298.     case PENTAIONIAN:
  299.         void printf("pentatonic major")
  300.     end
  301.     case PENTADORIAN:
  302.         void printf("pentatonic dorian")
  303.     end
  304.     case PENTAPHRYGIAN:
  305.         void printf("pentatonic phrygian")
  306.     end
  307.     case PENTALYDIAN:
  308.         void printf("pentatonic lydian")
  309.     end
  310.     case PENTAAEOLIAN:
  311.         void printf("pentatonic aeolian")
  312.     end
  313.     end
  314. end
  315.